using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using DeathReportManagement.Services;

namespace DeathReportManagement.Controllers;

[Authorize(Roles = "Admin")]
public class AdminController : Controller
{
    private readonly DeathReportService _deathReportService;
    private readonly AuthService _authService;
    
    public AdminController(DeathReportService deathReportService, AuthService authService)
    {
        _deathReportService = deathReportService;
        _authService = authService;
    }
    
    public async Task<IActionResult> Index()
    {
        var reports = await _deathReportService.GetReportsAsync();
        return View(reports);
    }
    
    public async Task<IActionResult> PendingAudit()
    {
        var reports = await _deathReportService.GetReportsAsync(auditStatus: 0);
        return View("Index", reports);
    }
    
    public async Task<IActionResult> PendingReport()
    {
        var reports = await _deathReportService.GetReportsAsync(reportStatus: 1);
        return View("Index", reports);
    }
}